﻿@{
    ViewBag.WLTZhangHuGuanLiView = "active";
    ViewBag.Title = "账户管理";
    Layout = "~/Views/Shared/_layout_wenlvting.cshtml";
}

<div class="sousuo">
    <div class="new_user"><button class="new_btn"  onclick="to_url('/WenLvTing/WLTZhangHuShow?leixing=3');">  新建子账户</button></div>
    <div class="new_user"><button class="new_btn"  onclick="to_url('/WenLvTing/WLTZhangHuShow?leixing=2');"> 新建子管理员</button></div>
</div>
<div class="tab_fill">
    <table width="95%" border="0" cellspacing="0" cellpadding="0" class="tab_tb">
        <tr>
            <td class="top_bt bt_w15">编号</td>
            <td class="top_bt bt_w15">账户类型</td>
            <td class="top_bt bt_w15">姓名</td>
            <td class="top_bt bt_w15">登录号码</td>
            <td class="top_bt ">区域/权限</td>
            <td class="top_bt  bt_w30">操作</td>
        </tr>
        <tr v-for="(item,index) in lisyh">
            <td>{{++index}}</td>
            <td>{{item.leixing_str}}</td>
            <td>{{item.xingming}}</td>
            <td>{{item.zhanghao}}</td>
            <td>{{item.aid_json_str+':'+item.quanxian_str}}</td>
            <td>
                <button v-if="item.zhuangtai==2" class="btn btn-xs btn-success" v-on:click="WLTYHZhuangTaiP(item.id,1)">启用</button>
                <button v-if="item.zhuangtai==1" class="btn btn-xs btn-warning" v-on:click="WLTYHZhuangTaiP(item.id,2)">停用</button>
                <button class="btn btn-xs btn-info" v-on:click="ModifyYHInfoP(item.id)">编辑</button>
                <button class="btn btn-xs btn-danger" v-on:click="WLTYHZhuangTaiP(item.id,3)">删除</button>
            </td>
        </tr>
    </table>
</div>

<script>
    var vm = new Vue({
        el: '#app',
        data: {
            lisyh: [],

        },
        methods: {
            WLTGetUserP: function () {
                $.post("/WenLvTing/WLTGetUserP", {}, function (res) {
                    vm.lisyh = res;
                })
            },
            WLTYHZhuangTaiP: function (yhwltid, zt) {
                $.post("/WenLvTing/WLTYHZhuangTaiP", { yhwltid: yhwltid, zt: zt }, function (res) {
                    if (res.code > 0) {
                        vm.WLTGetUserP();
                    }
                    else {
                        alert(res.msg);
                    }
                })
            },
            ModifyYHInfoP: function (yhwltid) {
                to_url('/WenLvTing/WLTZhangHuShow?yhwltid=' + yhwltid);
            }


        }
    })

    $(function () {
        vm.WLTGetUserP();
    });
</script>
